﻿using Marqdown;
using NUnit.Framework;

namespace MarkdownSharpTests
{
    [TestFixture]
    class TestMarkdownSharp2
    {
        private Markdown _m;
        [SetUp]
        public void SetUp()
        {
            _m = new Markdown();
        }
        protected string Transform(string input)
        {
            return _m.Transform(input);
        }

        [Test]
        public void NoLinks()
        {
            Assert.AreEqual(0, _m.LinkMapSize());
        }
        [Test]
        public void Link()
        {
            string input = "This is [a link][1].\n\n  [1]: http://www.example.com";
            //string expected = "<p>This is <a href=\"http://www.example.com\">a link</a>.</p>\n";

            string actual = Transform(input);

            Assert.AreEqual(1, _m.LinkMapSize());
        }
        [Test]
        public void LinksOne()
        {
            string input = "This is [a link][1].\n\n  [1]: url\n  [1]: url2";

            string actual = Transform(input);

            Assert.AreEqual(1, _m.LinkMapSize());
        }
        [Test]
        public void LinksTwo()
        {
            string input = "This is [a link][1].\n\n  [1]: url\n  [2]: url2";

            string actual = Transform(input);

            Assert.AreEqual(2, _m.LinkMapSize());
        }

        //[Test]
        public void TestCompetitiveStatesLoseChars()
        {
            string input = "--1\nLose Chars\n";
            string expected = "<p>A bulleted list:</p>\n\n<ul>\n<li>a</li>\n<li>b</li>\n<li>c</li>\n</ul>\n";

            string actual = Transform(input);

            Assert.AreEqual(expected, actual);
        }


        [Test]
        public void BoldAndItalic2()
        {
            string input = "This is ***bold *and* italic***. This is also ___bold *and* italic___.";
            string expected = "<p>This is <strong><em>bold </em>and<em> italic</em></strong>. This is also <strong><em>bold </em>and<em> italic</em></strong>.</p>\n";

            string actual = Transform(input);

            Assert.AreEqual(expected, actual);
        }

    }
}
